# coding:utf-8
import json
import sys
import requests

if __name__ == '__main__':
	# step1
	jsonStr = sys.argv[1]
	# 编写python 调用 java 数据网关的接口返回 数据
	result = json.loads(jsonStr)
	# result dict result的类型
	# 把字典转成字符串
	str = json.dumps(result)
	# 调用数据网关接口 得到结果
	host = 'http://zebra.dev.com'
	server_name = '/service-interface-gateway'
	method = '/api/invoke'
	url = host + server_name + method
	header_dict = {"Content-Type": "application/json; charset=utf8"}
	r = requests.post(url, data=str, headers=header_dict)
	json_data = ''
	if (r.ok):
		json_data = r.json()

	# step2
	print(json_data)
